@use "../core/color";
@use "../core/layout";
@use "../core/typography";

// Share widget
// ---------------
// The widget that allows social linking and the ability to
// copy a url for use elsewhere.


.js-share-widget {
  // for when js can't hide it, we need
  // to have the default state be hidden
  visibility: hidden;

  // we want template to have no effect
  // on the page layout, but keep it in it's
  // current flow
  height:0;
  width:0;
}

// The actual container that maintains the positioning of the widget
.share-widget {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  background: color.$white;
  border: 1px solid color.$grey-3;
  border-radius: 2px;
  width: 200px;
  font-size: typography.$normal-font-size;
  cursor: default;
  box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.15);

  // Styling for the dialog box tail(arrow) pointing down at the
  // 'Share' button
  &:after, &:before {
    top: 100%;
    right: 10px;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
  }

  &:after {
    border-color: rgba(255, 255, 255, 0);
    border-top-color: color.$white;
    border-width: 5px;
    margin-right: -5px;
  }

  &:before {
    border-color: rgba(211, 211, 211, 0);
    border-top-color: color.$grey-3;
    border-width: 6px;
    margin-right: -6px;
  }
}

.share-widget-msg {
  color: color.$grey-5;
  margin: -5px 10px 10px 10px;
  line-height: 15px;
  font-size: 11px;
}

.share-widget-msg__audience {
  font-style: italic;
}

// The link is the URL that is displayed for the user to copy
.share-widget-link {
  position: relative;

  font-size: typography.$normal-font-size;
  margin: 10px;
  padding: 5px;
  color: color.$grey-5;
  border: 1px solid color.$grey-3;
  border-radius: 2px;
  background: color.$grey-1;
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  flex-direction: row;
}

.share-widget-link:hover {
  color: color.$grey-7;
}

.share-widget-link__text {
  overflow: hidden;
  border: none;
  width: 100%;
  background: color.$white;
}

.share-widget-link__btn {
  padding: 0;
  margin-left: 6px;
  min-width: 15px;
  border: 0;
  background: transparent;
}

.share-widget-link__btn--copy {
  margin-top: 5px;
  margin-bottom: 5px;
  width: 13px;
  height: 16px;
}

// share actions are items set to have hover feedback
.share-widget-action {
  color: color.$grey-4;
}

.share-widget-action:hover {
  color: color.$grey-6;
}

// The targets are direct links to other social media locations
.share-widget-target {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  border-bottom: 1px solid color.$grey-3;
  font-size: typography.$normal-font-size;
  padding: 10px;
}

.share-widget-target__label {
  font-weight: bold;
  color: color.$grey-4;
}

.share-widget-target__icon {
  color: color.$grey-5;
  text-decoration: none;
  font-size: 20px;
  cursor: pointer;
}

.share-widget-target__icon:hover {
  color: color.$grey-7;
}

@include layout.touch-input {
  // prevent zoom on smaller devices
  .share-widget-link input {
    font-size: typography.$touch-input-font-size;
  }
}
